package cn.ddd.linktran.application.service;

import cn.ddd.linktran.application.executor.command.AppAccessRegisterCmdExe;
import cn.ddd.linktran.application.executor.command.TokenGenerateCmdExe;
import cn.ddd.linktran.client.api.TokenService;
import cn.ddd.linktran.client.dto.cmd.AppAccessRegisterCmd;
import cn.ddd.linktran.client.dto.cmd.TokenGenerateCmd;
import cn.ddd.linktran.client.dto.data.AppAccessDTO;
import com.alibaba.cola.dto.SingleResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

@Service
@Primary
@Slf4j
public class TokenServiceImpl implements TokenService {
    @Autowired
    AppAccessRegisterCmdExe appAccessRegisterCmdExe;

    @Autowired
    TokenGenerateCmdExe tokenGenerateCmdExe;
    @Override
    public SingleResponse<AppAccessDTO> register(AppAccessRegisterCmd appAccessRegisterCmd) {

        return appAccessRegisterCmdExe.execute(appAccessRegisterCmd);
    }

    @Override
    public SingleResponse<String> generateToken(TokenGenerateCmd tokenGenerateCmd) {

        return tokenGenerateCmdExe.execute(tokenGenerateCmd);
    }
}
